﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Iguana.Core.HypterText.Attributes
{
    public class xmlns : IAttribute
    {
        private bool m_Required = true;
        private string m_Name;
        private string m_Value;
        private AttributeDataType m_Type;
        private HTML4Compliance m_Compliance;
        private List<String> m_AcceptableValues;

        public xmlns()
        {
            m_Name = "xmlns";

            m_AcceptableValues = new List<string>();
            m_AcceptableValues.Add("http://www.w3.org/1999/xhtml");

            // The default value.
            m_Value = m_AcceptableValues[0];

            m_Type = AttributeDataType.URI;

            // TODO: This is set to false for now. Iguana will assume XHTML, so a DOCTYPE will be included. XMLNS is not required if using DOCTYPE (to my best understanding).
            m_Required = false;
            m_Compliance = UtilDocTypes.ReturnCommonSTF();
        }

        public bool Required
        {
            get
            {
                return m_Required;
            }
            set
            {
                m_Required = value;
            }
        }

        public string Name
        {
            get
            {
                return m_Name;
            }
            set
            {
                m_Name = value;
            }
        }

        public string Value
        {
            get
            {
                return m_Value;
            }
            set
            {
                m_Value = UtilAttributes.SetAttribute(this, value);
            }
        }

        public AttributeDataType Type
        {
            get
            {
                return m_Type;
            }
            set
            {
                m_Type = value;
            }
        }

        public override string ToString()
        {
            return String.Format(SR.SR_ATTRIBUTE_NAME_VALUE_PAIR, Name, Value);
        }


        public HTML4Compliance CompiancyObject
        {
            get { return m_Compliance; }
        }


        public bool PreDefinedValues
        {
            get
            {
                return true;
            }
           
        }

        public List<string> AcceptableValues
        {
            get
            {
                return m_AcceptableValues;
            }
        }
    }
}
